package com.yonyou.biz.actions;

import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.command.WriteCommandAction;
import com.intellij.openapi.fileTypes.StdFileTypes;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*;
import com.intellij.psi.search.FileTypeIndex;
import com.intellij.psi.search.GlobalSearchScope;
import com.yonyou.component.importProcess;
import com.yonyou.demo.CtmDemo;
import org.jetbrains.annotations.NotNull;
import com.intellij.psi.search.*;

import java.util.*;
import java.util.Collection;

public class AutoImport1 extends AnAction {
    public static Map<String, PsiClass> delSt=new HashMap<String, PsiClass>();
    public static Map<String,String> other=new HashMap();
    public static List<String > del_ingoing = new ArrayList();
    public static Map<String,String> replace_text=new HashMap();

    static{
         other.put("com.yonyoucloud.fi.tlm.rule.manager.rl001","com.yonyou.ctp.finance.rule.manager.rl001");
         other.put("com.yonyoucloud.fi.tlm.rule.enums.common","com.yonyou.ctp.finance.enums.rule.common");
         other.put("com.yonyoucloud.fi.tlm.rule.domain","com.yonyou.ctp.finance.rule.domain");
         other.put("com.yonyoucloud.fi.tlm.rule.domain.interest","com.yonyou.ctp.finance.rule.domain.interest");
         other.put("com.yonyoucloud.fi.tlm.rule.domain.bo.interest.rate.type","com.yonyou.ctp.finance.rule.domain.bo.interest.rate.type");
        del_ingoing.add("com.yonyoucloud.fi.tlm.utils.RuleUtils");
        del_ingoing.add("com.yonyoucloud.fi.tlm.purchaseregister.service.association.NodeType");
        del_ingoing.add("com.yonyoucloud.fi.tlm.rule.util.DateUtils");
        del_ingoing.add("com.yonyoucloud.fi.tlm.utils.RestTemplateUtils");
        del_ingoing.add("com.yonyoucloud.fi.basecom.utils.AssertUtils");
        del_ingoing.add("com.yonyoucloud.fi.tlm.utils.BigDecimalUtils");
        del_ingoing.add("com.yonyoucloud.fi.tlm.utils.BillUtils");
        del_ingoing.add("com.yonyoucloud.fi.tlm.rule.util.DeepCopyUtils");
        del_ingoing.add("com.yonyoucloud.fi.tlm.rule.service.flowtype.RuleFinancialProductService");
        del_ingoing.add("com.yonyoucloud.fi.fusion.util.FusionUtil");
        del_ingoing.add("com.yonyoucloud.fi.tlm.withholding.service.RuleEngineService");
        del_ingoing.add("com.yonyoucloud.fi.tlm.rule.util.interest.InterestRateUtils");
        del_ingoing.add("com.yonyoucloud.fi.fusion.adapter.enums.biz.InterestBasisEnumAdapter");
        del_ingoing.add("com.yonyoucloud.fi.fusion.adapter.enums.biz.TimeUnitFrequencyEnumAdapter");

        replace_text.put("com.yonyoucloud.fi.tlm.enums.HolidayPrincipleEnum.","HolidayPrincipleEnum.");
        replace_text.put("com.yonyoucloud.fi.tlm.rule.enums.HolidayPrincipleEnum.","HolidayPrincipleEnum.");
        replace_text.put("HolidayPrincipleEnum.DELAYED.getCode()","HolidayPrincipleEnum.DELAY.getCode()");
        replace_text.put("com.yonyoucloud.fi.tlm.rule.enums.HolidayPrincipleEnum ","HolidayPrincipleEnum ");

    }

    @Override
    public void actionPerformed(@NotNull AnActionEvent e) {
        Project project = e.getProject();
        if (project == null) return;

        ProgressManager.getInstance().run(new importProcess(project, "自动导包"));
    }
}
